package com.rockcent.mall.lib.repository;

import com.rockcent.common.domain.enumclass.Whether;
import com.rockcent.mall.lib.domain.UserMerchant;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by hone on 17-4-26.
 */
@Repository
public interface UserMerchantRepository extends JpaRepository<UserMerchant, Long>, JpaSpecificationExecutor, UserMerchantRepositoryCustom {

    List<UserMerchant> findByUserIdAndAvailable(Long userId, Whether whether);

    UserMerchant findByUserIdAndMallIdAndMerchantId(Long id, Long mallId, Long merchantId);

    List<UserMerchant> findByTitleId(Long id);

    List<UserMerchant> findByMerchantId(Long merchantId);

    List<UserMerchant> findByMerchantIdAndIsSuperAdmin(Long merchantId, Whether isSuperAdmin);
}
